package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.YzLiwu;
import com.ruoyi.system.mapper.YzLiwuMapper;
import com.ruoyi.system.service.IYzLiwuService;
import com.ruoyi.system.util.IdGenerate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 礼物信息Service业务层处理
 *
 * @author linpq
 * @date 2020-04-10
 */
@Service
public class YzLiwuServiceImpl implements IYzLiwuService
{
    @Autowired
    private YzLiwuMapper yzLiwuMapper;

    /**
     * 查询礼物信息
     *
     * @param id 礼物信息ID
     * @return 礼物信息
     */
    @Override
    public YzLiwu selectYzLiwuById(String id)
    {
        return yzLiwuMapper.selectYzLiwuById(id);
    }

    /**
     * 查询礼物信息列表
     *
     * @param yzLiwu 礼物信息
     * @return 礼物信息
     */
    @Override
    public List<YzLiwu> selectYzLiwuList(YzLiwu yzLiwu)
    {
        return yzLiwuMapper.selectYzLiwuList(yzLiwu);
    }
    public List<YzLiwu> selectYzLiwuListMoreThenOne()
    {
        return yzLiwuMapper.selectYzLiwuListMoreThenOne();
    }

    /**
     * 新增礼物信息
     *
     * @param yzLiwu 礼物信息
     * @return 结果
     */
    @Override
    public int insertYzLiwu(YzLiwu yzLiwu)
    {
        yzLiwu.setCreateTime(DateUtils.getNowDate());
        yzLiwu.setId(IdGenerate.uuid());
        return yzLiwuMapper.insertYzLiwu(yzLiwu);
    }

    /**
     * 修改礼物信息
     *
     * @param yzLiwu 礼物信息
     * @return 结果
     */
    @Override
    public int updateYzLiwu(YzLiwu yzLiwu)
    {
        yzLiwu.setUpdateTime(DateUtils.getNowDate());
        return yzLiwuMapper.updateYzLiwu(yzLiwu);
    }

    /**
     * 删除礼物信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteYzLiwuByIds(String ids)
    {
        return yzLiwuMapper.deleteYzLiwuByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除礼物信息信息
     *
     * @param id 礼物信息ID
     * @return 结果
     */
    @Override
    public int deleteYzLiwuById(String id)
    {
        return yzLiwuMapper.deleteYzLiwuById(id);
    }
}
